<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>new (MySpace::MySpaceContext)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File myspace/context/MySpaceContext.rb, line 50</span>
    <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">oauth_token_key</span>, <span class="ruby-identifier">oauth_token_secret</span>, <span class="ruby-identifier">params</span> = {})
      <span class="ruby-ivar">@http_logger</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:logger</span>]
      <span class="ruby-identifier">site</span> = <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:site</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">:prod</span>
       <span class="ruby-ivar">@consumer</span> = <span class="ruby-operator">::</span><span class="ruby-constant">OAuth</span><span class="ruby-operator">::</span><span class="ruby-constant">Consumer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">oauth_token_key</span>,
                                        <span class="ruby-identifier">oauth_token_secret</span>,
                                        <span class="ruby-identifier">:scheme</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:query_string</span>,
                                        <span class="ruby-comment cmt"># :scheme =&gt; :header,</span>
                                        <span class="ruby-identifier">:http_method</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:get</span>,
                                        <span class="ruby-identifier">:site</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">OAUTH_SITES</span>[<span class="ruby-identifier">site</span>],
                                        <span class="ruby-identifier">:request_token_path</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">OAUTH_REQUEST_TOKEN_URL</span>,
                                        <span class="ruby-identifier">:access_token_path</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">OAUTH_ACCESS_TOKEN_URL</span>,
                                        <span class="ruby-identifier">:authorize_path</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">OAUTH_AUTHORIZATION_URL</span>)

      <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:application_type</span>] <span class="ruby-operator">==</span> <span class="ruby-constant">APPLICATION_TYPE_ONSITE</span>
        <span class="ruby-ivar">@access_token</span> = <span class="ruby-operator">::</span><span class="ruby-constant">OAuth</span><span class="ruby-operator">::</span><span class="ruby-constant">AccessToken</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@consumer</span>, <span class="ruby-value str">&quot;&quot;</span>, <span class="ruby-value str">&quot;&quot;</span>)
      <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:access_token</span>]
        <span class="ruby-ivar">@access_token</span> = <span class="ruby-operator">::</span><span class="ruby-constant">OAuth</span><span class="ruby-operator">::</span><span class="ruby-constant">AccessToken</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@consumer</span>,
                                                 <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:access_token</span>],
                                                 <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:access_token_secret</span>])
      <span class="ruby-keyword kw">end</span>
      <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:request_token</span>]
        <span class="ruby-ivar">@request_token</span> = <span class="ruby-operator">::</span><span class="ruby-constant">OAuth</span><span class="ruby-operator">::</span><span class="ruby-constant">RequestToken</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@consumer</span>,
                                                   <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:request_token</span>],
                                                   <span class="ruby-identifier">params</span>[<span class="ruby-identifier">:request_token_secret</span>])
      <span class="ruby-keyword kw">end</span>
     
     <span class="ruby-keyword kw">end</span></pre>
</body>
</html>